﻿using System;
using System.Collections.Generic;
using System.Text;

namespace HamcoWcs.Models.Devices
{
    /// <summary>
    /// 堆垛机货位定位信息
    /// </summary>
    public class SrmTeachInfo1
    {
        public SrmTeachItem C1 { get; set; }
        public SrmTeachItem C2 { get; set; }
    }

    /// <summary>
    /// 堆垛机货位定位信息内容
    /// </summary>
    public class SrmTeachItem
    {
        /// <summary>
        /// 行走轴坐标
        /// </summary>
        public float X { get; set; }
        /// <summary>
        /// 升降轴高位坐标
        /// </summary>
        public float Y1 { get; set; }
        /// <summary>
        /// 升降轴低位坐标
        /// </summary>
        public float Y2 { get; set; }
        /// <summary>
        /// 货叉伸出坐标
        /// </summary>
        public float Z { get; set; }
    }

    /// <summary>
    /// 前端请求的值
    /// </summary>
    public class GetSrmTeachRequestModel
    {
        public string ShelfName { get; set; }
    }

    /// <summary>
    /// 获取定位值的模型
    /// </summary>
    public class GetSrmTeachModel : GetSrmTeachRequestModel
    {
        /// <summary>
        /// 生成模型让后端向设备请求
        /// </summary>
        /// <returns></returns>
        public static GetSrmTeachModel Build(GetSrmTeachRequestModel req)
            => new GetSrmTeachModel
                {
                    ShelfName = req.ShelfName,
                    Row = int.Parse(req.ShelfName[..2]),
                    Bay = int.Parse(req.ShelfName[2..4]),
                    Lev = int.Parse(req.ShelfName[5..]),
                };

        /// <summary>
        /// 货位排
        /// </summary>
        public int Row { get; set; }
        /// <summary>
        /// 货位列
        /// </summary>
        public int Bay { get; set; }
        /// <summary>
        /// 货位层
        /// </summary>
        public int Lev { get; set; }
    }
}
